home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume19 / dmake / part24 < prev    next >
Encoding:
Text File  |  1991-05-12  |  40.2 KB  |  1,200 lines

  1. Newsgroups: comp.sources.misc
  2. From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  3. Subject:  v19i045:  dmake - dmake version 3.7, Part24/37
  4. Message-ID: <1991May12.221416.16312@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 6faf1c0510fe9ff177f3ac09d9555458
  6. Date: Sun, 12 May 1991 22:14:16 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  10. Posting-number: Volume 19, Issue 45
  11. Archive-name: dmake/part24
  12. Supersedes: dmake-3.6: Volume 15, Issue 52-77
  13.  
  14. ---- Cut Here and feed the following to sh ----
  15. #!/bin/sh
  16. # this is dmake.shar.24 (part 24 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file dmake/msdos/mscdos/mk60.bat continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 24; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test -f _shar_wnt_.tmp; then
  33. sed 's/^X//' << 'SHAR_EOF' >> 'dmake/msdos/mscdos/mk60.bat' &&
  34. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\hash.obj hash.c
  35. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dag.obj dag.c
  36. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmake.obj dmake.c
  37. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\path.obj path.c
  38. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\imacs.obj imacs.c
  39. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\sysintf.obj sysintf.c
  40. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\parse.obj parse.c
  41. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\getinp.obj getinp.c
  42. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\quit.obj quit.c
  43. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\state.obj state.c
  44. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\basename.obj basename.c
  45. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmdump.obj dmdump.c
  46. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\macparse.obj macparse.c
  47. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rulparse.obj rulparse.c
  48. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\percent.obj percent.c
  49. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\function.obj function.c
  50. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\ruletab.obj msdos\ruletab.c
  51. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dirbrk.obj msdos\dirbrk.c
  52. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\runargv.obj msdos\runargv.c
  53. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\arlib.obj msdos\arlib.c
  54. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\_chdir.obj msdos\_chdir.c
  55. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\switchar.obj msdos\switchar.c
  56. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rmprq.obj msdos\rmprq.c
  57. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tee.obj msdos\tee.c
  58. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tempnam.obj msdos\mscdos\tempnam.c
  59. link @\tmp\mkAAA010699,dmake.exe,NUL.MAP;
  60. copy msdos\mscdos\startup.mk startup.mk
  61. SHAR_EOF
  62. chmod 0640 dmake/msdos/mscdos/mk60.bat ||
  63. echo 'restore of dmake/msdos/mscdos/mk60.bat failed'
  64. Wc_c="`wc -c < 'dmake/msdos/mscdos/mk60.bat'`"
  65. test 2932 -eq "$Wc_c" ||
  66.     echo 'dmake/msdos/mscdos/mk60.bat: original size 2932, current size' "$Wc_c"
  67. rm -f _shar_wnt_.tmp
  68. fi
  69. # ============= dmake/msdos/mscdos/mk60swp.bat ==============
  70. if test -f 'dmake/msdos/mscdos/mk60swp.bat' -a X"$1" != X"-c"; then
  71.     echo 'x - skipping dmake/msdos/mscdos/mk60swp.bat (File already exists)'
  72.     rm -f _shar_wnt_.tmp
  73. else
  74. > _shar_wnt_.tmp
  75. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/mk60swp.bat' &&
  76. md objects
  77. masm -t -mx -Dmlarge msdos\exec.asm;
  78. mv exec.obj objects
  79. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\infer.obj infer.c
  80. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\make.obj make.c
  81. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\stat.obj stat.c
  82. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\expand.obj expand.c
  83. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmstring.obj dmstring.c
  84. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\hash.obj hash.c
  85. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dag.obj dag.c
  86. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmake.obj dmake.c
  87. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\path.obj path.c
  88. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\imacs.obj imacs.c
  89. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\sysintf.obj sysintf.c
  90. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\parse.obj parse.c
  91. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\getinp.obj getinp.c
  92. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\quit.obj quit.c
  93. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\state.obj state.c
  94. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\basename.obj basename.c
  95. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dmdump.obj dmdump.c
  96. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\macparse.obj macparse.c
  97. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rulparse.obj rulparse.c
  98. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\percent.obj percent.c
  99. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\function.obj function.c
  100. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\ruletab.obj msdos\ruletab.c
  101. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\dirbrk.obj msdos\dirbrk.c
  102. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\runargv.obj msdos\runargv.c
  103. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\arlib.obj msdos\arlib.c
  104. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\_chdir.obj msdos\_chdir.c
  105. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\switchar.obj msdos\switchar.c
  106. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\rmprq.obj msdos\rmprq.c
  107. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\find.obj msdos\find.c
  108. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\spawn.obj msdos\spawn.c
  109. cl -c -I. -Imsdos -Imsdos\mscdos -AL -D__STDC__=1 -Osecgl -Gs -Foobjects\tempnam.obj msdos\mscdos\tempnam.c
  110. link @\tmp\mkAAA010738,dmake.exe,NUL.MAP;
  111. copy msdos\mscdos\startup.mk startup.mk
  112. SHAR_EOF
  113. chmod 0640 dmake/msdos/mscdos/mk60swp.bat ||
  114. echo 'restore of dmake/msdos/mscdos/mk60swp.bat failed'
  115. Wc_c="`wc -c < 'dmake/msdos/mscdos/mk60swp.bat'`"
  116. test 3088 -eq "$Wc_c" ||
  117.     echo 'dmake/msdos/mscdos/mk60swp.bat: original size 3088, current size' "$Wc_c"
  118. rm -f _shar_wnt_.tmp
  119. fi
  120. # ============= dmake/msdos/mscdos/obj.rsp ==============
  121. if test -f 'dmake/msdos/mscdos/obj.rsp' -a X"$1" != X"-c"; then
  122.     echo 'x - skipping dmake/msdos/mscdos/obj.rsp (File already exists)'
  123.     rm -f _shar_wnt_.tmp
  124. else
  125. > _shar_wnt_.tmp
  126. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/obj.rsp' &&
  127. objects\infer.obj+
  128. objects\make.obj+
  129. objects\stat.obj+
  130. objects\expand.obj+
  131. objects\dmstring.obj+
  132. objects\hash.obj+
  133. objects\dag.obj+
  134. objects\dmake.obj+
  135. objects\path.obj+
  136. objects\imacs.obj+
  137. objects\sysintf.obj+
  138. objects\parse.obj+
  139. objects\getinp.obj+
  140. objects\quit.obj+
  141. objects\state.obj+
  142. objects\basename.obj+
  143. objects\dmdump.obj+
  144. objects\macparse.obj+
  145. objects\rulparse.obj+
  146. objects\percent.obj+
  147. objects\function.obj+
  148. objects\ruletab.obj+
  149. objects\dirbrk.obj+
  150. objects\runargv.obj+
  151. objects\arlib.obj+
  152. objects\_chdir.obj+
  153. objects\switchar.obj+
  154. objects\rmprq.obj+
  155. objects\tee.obj+
  156. objects\tempnam.obj
  157. SHAR_EOF
  158. chmod 0640 dmake/msdos/mscdos/obj.rsp ||
  159. echo 'restore of dmake/msdos/mscdos/obj.rsp failed'
  160. Wc_c="`wc -c < 'dmake/msdos/mscdos/obj.rsp'`"
  161. test 593 -eq "$Wc_c" ||
  162.     echo 'dmake/msdos/mscdos/obj.rsp: original size 593, current size' "$Wc_c"
  163. rm -f _shar_wnt_.tmp
  164. fi
  165. # ============= dmake/msdos/mscdos/objswp.rsp ==============
  166. if test -f 'dmake/msdos/mscdos/objswp.rsp' -a X"$1" != X"-c"; then
  167.     echo 'x - skipping dmake/msdos/mscdos/objswp.rsp (File already exists)'
  168.     rm -f _shar_wnt_.tmp
  169. else
  170. > _shar_wnt_.tmp
  171. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/objswp.rsp' &&
  172. objects\exec.obj+
  173. objects\infer.obj+
  174. objects\make.obj+
  175. objects\stat.obj+
  176. objects\expand.obj+
  177. objects\dmstring.obj+
  178. objects\hash.obj+
  179. objects\dag.obj+
  180. objects\dmake.obj+
  181. objects\path.obj+
  182. objects\imacs.obj+
  183. objects\sysintf.obj+
  184. objects\parse.obj+
  185. objects\getinp.obj+
  186. objects\quit.obj+
  187. objects\state.obj+
  188. objects\basename.obj+
  189. objects\dmdump.obj+
  190. objects\macparse.obj+
  191. objects\rulparse.obj+
  192. objects\percent.obj+
  193. objects\function.obj+
  194. objects\ruletab.obj+
  195. objects\dirbrk.obj+
  196. objects\runargv.obj+
  197. objects\arlib.obj+
  198. objects\_chdir.obj+
  199. objects\switchar.obj+
  200. objects\rmprq.obj+
  201. objects\find.obj+
  202. objects\spawn.obj+
  203. objects\tempnam.obj
  204. SHAR_EOF
  205. chmod 0640 dmake/msdos/mscdos/objswp.rsp ||
  206. echo 'restore of dmake/msdos/mscdos/objswp.rsp failed'
  207. Wc_c="`wc -c < 'dmake/msdos/mscdos/objswp.rsp'`"
  208. test 631 -eq "$Wc_c" ||
  209.     echo 'dmake/msdos/mscdos/objswp.rsp: original size 631, current size' "$Wc_c"
  210. rm -f _shar_wnt_.tmp
  211. fi
  212. # ============= dmake/msdos/mscdos/optoff.h ==============
  213. if test -f 'dmake/msdos/mscdos/optoff.h' -a X"$1" != X"-c"; then
  214.     echo 'x - skipping dmake/msdos/mscdos/optoff.h (File already exists)'
  215.     rm -f _shar_wnt_.tmp
  216. else
  217. > _shar_wnt_.tmp
  218. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/optoff.h' &&
  219. #if _MSC_VER < 600
  220. # pragma loop_opt(off)
  221. #endif
  222. SHAR_EOF
  223. chmod 0640 dmake/msdos/mscdos/optoff.h ||
  224. echo 'restore of dmake/msdos/mscdos/optoff.h failed'
  225. Wc_c="`wc -c < 'dmake/msdos/mscdos/optoff.h'`"
  226. test 49 -eq "$Wc_c" ||
  227.     echo 'dmake/msdos/mscdos/optoff.h: original size 49, current size' "$Wc_c"
  228. rm -f _shar_wnt_.tmp
  229. fi
  230. # ============= dmake/msdos/mscdos/public.h ==============
  231. if test -f 'dmake/msdos/mscdos/public.h' -a X"$1" != X"-c"; then
  232.     echo 'x - skipping dmake/msdos/mscdos/public.h (File already exists)'
  233.     rm -f _shar_wnt_.tmp
  234. else
  235. > _shar_wnt_.tmp
  236. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/public.h' &&
  237. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/mscdos/RCS/public.h,v 1.1 91/05/06 15:25:50 dvadura Exp Locker: dvadura $
  238. -- WARNING  -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT
  239. --
  240. -- SYNOPSIS -- Local functions exported to be visible by others.
  241. --
  242. -- DESCRIPTION
  243. --      This file is generated by 'genpub'.  Function declarations
  244. --      that appear in this file are extracted by 'genpub' from
  245. --      source files.  Any function in the source file whose definition
  246. --      appears like:
  247. --
  248. --          PUBLIC return_type
  249. --          function( arg_list );
  250. --          type_expr1 arg1;
  251. --          ...
  252. --
  253. --      has its definition extracted and a line of the form:
  254. --
  255. --          return_type function ANSI((type_expr1,type_expr2,...));
  256. --
  257. --      entered into the output file.
  258. --
  259. -- AUTHOR
  260. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  261. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  262. --
  263. -- COPYRIGHT
  264. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  265. -- 
  266. --      This program is free software; you can redistribute it and/or
  267. --      modify it under the terms of the GNU General Public License
  268. --      (version 1), as published by the Free Software Foundation, and
  269. --      found in the file 'LICENSE' included with this distribution.
  270. -- 
  271. --      This program is distributed in the hope that it will be useful,
  272. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  273. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  274. --      GNU General Public License for more details.
  275. -- 
  276. --      You should have received a copy of the GNU General Public License
  277. --      along with this program;  if not, write to the Free Software
  278. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  279. --
  280. -- LOG
  281. --     $Log:    public.h,v $
  282. X * Revision 1.1  91/05/06  15:25:50  dvadura
  283. X * dmake Release Version 3.7
  284. X * 
  285. */
  286. X
  287. #ifndef _DMAKE_PUBLIC_h
  288. #define _DMAKE_PUBLIC_h
  289. X
  290. void Infer_recipe ANSI((CELLPTR, CELLPTR));
  291. int Make_targets ANSI(());
  292. int Exec_commands ANSI((CELLPTR));
  293. void Pop_dir ANSI((int));
  294. void Append_line ANSI((char *, int, FILE *, char *, int, int));
  295. void Stat_target ANSI((CELLPTR, int));
  296. char * Expand ANSI((char *));
  297. char * Apply_edit ANSI((char *, char *, char *, int, int));
  298. void Map_esc ANSI((char *));
  299. char* Apply_modifiers ANSI((int, char *));
  300. char* Tokenize ANSI((char *, char *));
  301. char * _strjoin ANSI((char *, char *, int, int));
  302. char * _stradd ANSI((char *, char *, int));
  303. char * _strapp ANSI((char *, char *));
  304. char * _strdup ANSI((char *));
  305. char * _strpbrk ANSI((char *, char *));
  306. char * _strspn ANSI((char *, char *));
  307. char * _strstr ANSI((char *, char *));
  308. char * _substr ANSI((char *, char *));
  309. uint16 Hash ANSI((char *, uint32 *));
  310. HASHPTR Get_name ANSI((char *, HASHPTR *, int));
  311. HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *));
  312. HASHPTR Def_macro ANSI((char *, char *, int));
  313. CELLPTR Def_cell ANSI((char *));
  314. LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int));
  315. void Clear_prerequisites ANSI((CELLPTR));
  316. int Test_circle ANSI((CELLPTR, int));
  317. STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int));
  318. t_attr Rcp_attribute ANSI((char *));
  319. int main ANSI((int, char **));
  320. FILE * Openfile ANSI((char *, int, int));
  321. FILE * Closefile ANSI(());
  322. FILE * Search_file ANSI((char *, char **));
  323. char * Filename ANSI(());
  324. void No_ram ANSI(());
  325. int Usage ANSI((int));
  326. int Version ANSI(());
  327. char * Get_suffix ANSI((char *));
  328. char * Build_path ANSI((char *, char *));
  329. void Make_rules ANSI(());
  330. void Create_macro_vars ANSI(());
  331. time_t Do_stat ANSI((char *, char *, char **));
  332. int Do_touch ANSI((char *, char *, char **));
  333. void Void_lib_cache ANSI((char *, char *));
  334. time_t Do_time ANSI(());
  335. int Do_cmnd ANSI((char *, int, int, CELLPTR, int, int, int));
  336. char ** Pack_argv ANSI((int, int, char *));
  337. char * Read_env_string ANSI((char *));
  338. int Write_env_string ANSI((char *, char *));
  339. void ReadEnvironment ANSI(());
  340. void Catch_signals ANSI((void (*)()));
  341. void Clear_signals ANSI(());
  342. void Prolog ANSI((int, char* []));
  343. void Epilog ANSI((int));
  344. char * Get_current_dir ANSI(());
  345. int Set_dir ANSI((char*));
  346. char Get_switch_char ANSI(());
  347. FILE* Get_temp ANSI((char **, char *, int));
  348. FILE * Start_temp ANSI((char *, CELLPTR, char **));
  349. void Open_temp_error ANSI((char *, char *));
  350. void Link_temp ANSI((CELLPTR, FILE *, char *));
  351. void Close_temp ANSI((CELLPTR, FILE *));
  352. void Unlink_temp_files ANSI((CELLPTR));
  353. void Handle_result ANSI((int, int, int, CELLPTR));
  354. void Update_time_stamp ANSI((CELLPTR));
  355. void Parse ANSI((FILE *));
  356. int Get_line ANSI((char *, FILE *));
  357. char * Do_comment ANSI((char *, char **, int));
  358. char * Get_token ANSI((TKSTRPTR, char *, int));
  359. void Quit ANSI(());
  360. void Read_state ANSI(());
  361. void Write_state ANSI(());
  362. int Check_state ANSI((CELLPTR, STRINGPTR *, int));
  363. char* basename ANSI((char *));
  364. void Dump ANSI(());
  365. void Dump_recipe ANSI((STRINGPTR));
  366. int Parse_macro ANSI((char *, int));
  367. int Macro_op ANSI((char *));
  368. int Parse_rule_def ANSI((int *));
  369. int Rule_op ANSI((char *));
  370. void Add_recipe_to_list ANSI((char *, int, int));
  371. void Bind_rules_to_targets ANSI((int));
  372. int Set_group_attributes ANSI((char *));
  373. DFALINKPTR Match_dfa ANSI((char *));
  374. void Check_circle_dfa ANSI(());
  375. void Add_nfa ANSI((char *));
  376. char * Exec_function ANSI((char *));
  377. int If_root_path ANSI((char *));
  378. int runargv ANSI((CELLPTR, int, int, int, int, char *));
  379. void Clean_up_processes ANSI(());
  380. int Wait_for_child ANSI((int, int));
  381. time_t seek_arch ANSI((char*, char*));
  382. int touch_arch ANSI((char*, char*));
  383. int _chdir ANSI((char *));
  384. void Remove_prq ANSI((CELLPTR));
  385. void Hook_std_writes ANSI((char *));
  386. X
  387. #endif
  388. SHAR_EOF
  389. chmod 0640 dmake/msdos/mscdos/public.h ||
  390. echo 'restore of dmake/msdos/mscdos/public.h failed'
  391. Wc_c="`wc -c < 'dmake/msdos/mscdos/public.h'`"
  392. test 5622 -eq "$Wc_c" ||
  393.     echo 'dmake/msdos/mscdos/public.h: original size 5622, current size' "$Wc_c"
  394. rm -f _shar_wnt_.tmp
  395. fi
  396. # ============= dmake/msdos/mscdos/startup.mk ==============
  397. if test -f 'dmake/msdos/mscdos/startup.mk' -a X"$1" != X"-c"; then
  398.     echo 'x - skipping dmake/msdos/mscdos/startup.mk (File already exists)'
  399.     rm -f _shar_wnt_.tmp
  400. else
  401. > _shar_wnt_.tmp
  402. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/startup.mk' &&
  403. # MSDOS DMAKE startup file.  Customize to suit your needs.
  404. # Assumes MKS toolkit for the tool commands, and Microsoft C.  Change as req'd.
  405. # See the documentation for a description of internally defined macros.
  406. #
  407. # Disable warnings for macros redefined here that were given
  408. # on the command line.
  409. __.SILENT := $(.SILENT)
  410. .SILENT   := yes
  411. X
  412. # Configuration parameters for DMAKE startup.mk file
  413. # Set these to NON-NULL if you wish to turn the parameter on.
  414. _HAVE_RCS    := yes        # yes => RCS  is installed.
  415. _HAVE_SCCS    :=         # yes => SCCS is installed.
  416. X
  417. # Applicable suffix definitions
  418. A := .lib    # Libraries
  419. E := .exe    # Executables
  420. F := .for    # Fortran
  421. O := .obj    # Objects
  422. P := .pas    # Pascal
  423. S := .asm    # Assembler sources
  424. V :=         # RCS suffix
  425. X
  426. # See if these are defined
  427. TMPDIR := $(ROOTDIR)/tmp
  428. .IMPORT .IGNORE : TMPDIR SHELL COMSPEC
  429. X
  430. # Recipe execution configurations
  431. # First set SHELL, If it is not defined, use COMSPEC, otherwise
  432. # it is assumed to be MKS Korn SHELL.
  433. .IF $(SHELL) == $(NULL)
  434. .IF $(COMSPEC) == $(NULL)
  435. X   SHELL := $(ROOTDIR)/bin/sh$E
  436. .ELSE
  437. X   SHELL := $(COMSPEC)
  438. .END
  439. .END
  440. GROUPSHELL := $(SHELL)
  441. X
  442. # Now set remaining arguments depending on which SHELL we
  443. # are going to use.  COMSPEC (assumed to be command.com) or
  444. # MKS Korn Shell.
  445. .IF $(SHELL)==$(COMSPEC)
  446. X   SHELLFLAGS  := $(SWITCHAR)c
  447. X   GROUPFLAGS  := $(SHELLFLAGS)
  448. X   SHELLMETAS  := *"?<>
  449. X   GROUPSUFFIX := .bat
  450. X   DIRSEPSTR   := \\
  451. X   DIVFILE      = $(TMPFILE:s,/,\)
  452. .ELSE
  453. X   SHELLFLAGS  := -c
  454. X   GROUPFLAGS  := 
  455. X   SHELLMETAS  := *"?<>|()&][$$\#`'
  456. X   GROUPSUFFIX := .ksh
  457. X   .MKSARGS    := yes
  458. X   DIVFILE      = $(TMPFILE:s,/,${DIVSEP_shell_${USESHELL}})
  459. X   DIVSEP_shell_yes := \\\
  460. X   DIVSEP_shell_no  := \\
  461. .END
  462. X
  463. # Standard C-language command names and flags
  464. X   CC      := cl        # C-compiler and flags
  465. X   CFLAGS  +=
  466. X
  467. X   AS      := masm        # Assembler and flags
  468. X   ASFLAGS +=
  469. X
  470. X   LD       = link        # Loader and flags
  471. X   LDFLAGS +=
  472. X   LDLIBS   =
  473. X
  474. # Definition of $(MAKE) macro for recursive makes.
  475. X   MAKE = $(MAKECMD) $(MFLAGS)
  476. X
  477. # Language and Parser generation Tools and their flags
  478. X   YACC      := yacc        # standard yacc
  479. X   YFLAGS +=
  480. X   YTAB      := ytab        # yacc output files name stem.
  481. X
  482. X   LEX      := lex        # standard lex
  483. X   LFLAGS +=
  484. X   LEXYY  := lex_yy        # lex output file
  485. X
  486. # Other Compilers, Tools and their flags
  487. X   PC    := any_pc        # pascal compiler
  488. X   RC    := anyf77        # ratfor compiler
  489. X   FC    := anyf77        # fortran compiler
  490. X
  491. X   CO       := co        # check out for RCS
  492. X   COFLAGS += -q
  493. X
  494. X   AR     := ar            # archiver
  495. X   ARFLAGS+= ruv
  496. X
  497. X   RM       := rm        # remove a file command
  498. X   RMFLAGS +=
  499. X
  500. # Implicit generation rules for making inferences.
  501. # We don't provide .yr or .ye rules here.  They're obsolete.
  502. # Rules for making *$O
  503. X   %$O : %.c ; $(CC) $(CFLAGS) -c $<
  504. X   %$O : %$P ; $(PC) $(PFLAGS) -c $<
  505. X   %$O : %$S ; $(AS) $(ASFLAGS) $(<:s,/,\);
  506. X   %$O : %.cl ; class -c $<
  507. X   %$O : %.e %.r %.F %$F ; $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
  508. X
  509. # Executables
  510. X   %$E : %$O ; $(CC) $(LDFLAGS) -o$@ $< $(LDLIBS)
  511. X
  512. # lex and yacc rules
  513. X   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
  514. X   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
  515. X
  516. # RCS support
  517. .IF $(_HAVE_RCS)
  518. X   % : $$(@:d)RCS$$(DIRSEPSTR)$$(@:f)$V;- $(CO) $(COFLAGS) $@
  519. X   .NOINFER : $$(@:d)RCS$$(DIRSEPSTR)$$(@:f)$V
  520. .END
  521. X
  522. # SCCS support
  523. .IF $(_HAVE_SCCS)
  524. X   % : s.% ; get $@
  525. X   .NOINFER : s.%
  526. .END
  527. X
  528. # Recipe to make archive files.
  529. %$A :
  530. [
  531. X   $(AR) $(ARFLAGS) $@ $?
  532. X   $(RM) $(RMFLAGS) $?
  533. ]
  534. X
  535. # DMAKE uses this recipe to remove intermediate targets
  536. .REMOVE :; $(RM) -f $<
  537. X
  538. # AUGMAKE extensions for SYSV compatibility
  539. @B = $(@:b)
  540. @D = $(@:d)
  541. @F = $(@:f)
  542. *B = $(*:b)
  543. *D = $(*:d)
  544. *F = $(*:f)
  545. <B = $(<:b)
  546. <D = $(<:d)
  547. <F = $(<:f)
  548. ?B = $(?:b)
  549. ?F = $(?:f)
  550. ?D = $(?:d)
  551. X
  552. # Turn warnings back to previous setting.
  553. .SILENT := $(__.SILENT)
  554. X
  555. # Local init file if any, gets parsed before user makefile
  556. .INCLUDE .IGNORE: "_startup.mk"
  557. SHAR_EOF
  558. chmod 0640 dmake/msdos/mscdos/startup.mk ||
  559. echo 'restore of dmake/msdos/mscdos/startup.mk failed'
  560. Wc_c="`wc -c < 'dmake/msdos/mscdos/startup.mk'`"
  561. test 3822 -eq "$Wc_c" ||
  562.     echo 'dmake/msdos/mscdos/startup.mk: original size 3822, current size' "$Wc_c"
  563. rm -f _shar_wnt_.tmp
  564. fi
  565. # ============= dmake/msdos/mscdos/tempnam.c ==============
  566. if test -f 'dmake/msdos/mscdos/tempnam.c' -a X"$1" != X"-c"; then
  567.     echo 'x - skipping dmake/msdos/mscdos/tempnam.c (File already exists)'
  568.     rm -f _shar_wnt_.tmp
  569. else
  570. > _shar_wnt_.tmp
  571. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/mscdos/tempnam.c' &&
  572. /*LINTLIBRARY*/
  573. #include <stdio.h>
  574. #include <string.h>
  575. #include <stdlib.h>
  576. #include <dos.h>
  577. X
  578. #if defined(max)
  579. #   undef  max
  580. #endif
  581. #define max(A,B) (((A)<(B))?(B):(A))
  582. X
  583. extern char *mktemp();
  584. extern int access();
  585. int _access();
  586. X
  587. /* MSC stdio.h defines P_tmpdir, so let's undo it here */
  588. /* Under DOS leave the default tmpdir pointing here!        */
  589. #ifdef P_tmpdir
  590. #undef P_tmpdir
  591. #endif
  592. static char *P_tmpdir = "";
  593. X
  594. char *
  595. tempnam(dir, prefix)
  596. char *dir;        /* use this directory please (if non-NULL) */
  597. char *prefix;        /* use this (if non-NULL) as filename prefix */
  598. {
  599. X   static         int count = 0;
  600. X   register char *p, *q, *tmpdir;
  601. X   int            tl=0, dl=0, pl;
  602. X   char          buf[30];
  603. X
  604. X   pl = strlen(P_tmpdir);
  605. X
  606. X   if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir);
  607. X   if( dir != NULL ) dl = strlen(dir);
  608. X
  609. X   if( (p = malloc((unsigned)(max(max(dl,tl),pl)+13))) == NULL )
  610. X     return(NULL);
  611. X
  612. X   *p = '\0';
  613. X
  614. X   if( (tl == 0) || (_access( strcpy(p, tmpdir), 0) != 0) )
  615. X     if( (dl == 0) || (_access( strcpy(p, dir), 0) != 0) )
  616. X    if( _access( strcpy(p, P_tmpdir), 0) != 0 )
  617. X       if( !prefix )
  618. X          prefix = "tp";
  619. X
  620. X   if(prefix)
  621. X   {
  622. X      *(p+strlen(p)+2) = '\0';
  623. X      (void)strncat(p, prefix, 2);
  624. X   }
  625. X
  626. X   sprintf( buf, "%08x", _psp );
  627. X   buf[6]='\0';
  628. X   (void)strcat(p, buf );
  629. X   sprintf( buf, "%04d", count++ );
  630. X   q=p+strlen(p)-6;
  631. X   *q++ = buf[0]; *q++ = buf[1];
  632. X   *q++ = buf[2]; *q++ = buf[3];
  633. X
  634. X   if( (q = strrchr(p,'.')) != NULL ) *q = '\0';
  635. X
  636. X   return(p);
  637. }
  638. X
  639. X
  640. X
  641. _access( name, flag )
  642. char *name;
  643. int  flag;
  644. {
  645. X   char *p;
  646. X   int r;
  647. X
  648. X   if( name == NULL || !*name ) return(1);  /* NULL dir means current dir */
  649. X   r = access( name, flag );
  650. X   p = name+strlen(name)-1;
  651. X   if(*p != '/' && *p != '\\') strcat( p, "/" );
  652. X
  653. X   return( r );
  654. }
  655. SHAR_EOF
  656. chmod 0640 dmake/msdos/mscdos/tempnam.c ||
  657. echo 'restore of dmake/msdos/mscdos/tempnam.c failed'
  658. Wc_c="`wc -c < 'dmake/msdos/mscdos/tempnam.c'`"
  659. test 1754 -eq "$Wc_c" ||
  660.     echo 'dmake/msdos/mscdos/tempnam.c: original size 1754, current size' "$Wc_c"
  661. rm -f _shar_wnt_.tmp
  662. fi
  663. # ============= dmake/msdos/rmprq.c ==============
  664. if test -f 'dmake/msdos/rmprq.c' -a X"$1" != X"-c"; then
  665.     echo 'x - skipping dmake/msdos/rmprq.c (File already exists)'
  666.     rm -f _shar_wnt_.tmp
  667. else
  668. > _shar_wnt_.tmp
  669. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/rmprq.c' &&
  670. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/rmprq.c,v 1.1 91/05/06 15:25:31 dvadura Exp $
  671. -- SYNOPSIS -- remove prerequisites code.
  672. -- 
  673. -- DESCRIPTION
  674. --    This code is different for DOS and for UNIX and parallel make
  675. --    architectures since the parallel case requires the rm's to be
  676. --    run in parallel, whereas DOS guarantees to run them sequentially.
  677. -- 
  678. -- AUTHOR
  679. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  680. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  681. --
  682. -- COPYRIGHT
  683. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  684. -- 
  685. --      This program is free software; you can redistribute it and/or
  686. --      modify it under the terms of the GNU General Public License
  687. --      (version 1), as published by the Free Software Foundation, and
  688. --      found in the file 'LICENSE' included with this distribution.
  689. -- 
  690. --      This program is distributed in the hope that it will be useful,
  691. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  692. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  693. --      GNU General Public License for more details.
  694. -- 
  695. --      You should have received a copy of the GNU General Public License
  696. --      along with this program;  if not, write to the Free Software
  697. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  698. --
  699. -- LOG
  700. --     $Log:    rmprq.c,v $
  701. X * Revision 1.1  91/05/06  15:25:31  dvadura
  702. X * dmake Release Version 3.7
  703. X * 
  704. */
  705. X
  706. #include "extern.h"
  707. X
  708. PUBLIC void
  709. Remove_prq( tcp )
  710. CELLPTR tcp;
  711. {
  712. X   tcp->ce_flag &= ~(F_MADE|F_VISITED);
  713. X   tcp->ce_time  = 0L;
  714. X
  715. X   Make( tcp, NIL(LINK), NIL(CELL) );
  716. }
  717. SHAR_EOF
  718. chmod 0640 dmake/msdos/rmprq.c ||
  719. echo 'restore of dmake/msdos/rmprq.c failed'
  720. Wc_c="`wc -c < 'dmake/msdos/rmprq.c'`"
  721. test 1640 -eq "$Wc_c" ||
  722.     echo 'dmake/msdos/rmprq.c: original size 1640, current size' "$Wc_c"
  723. rm -f _shar_wnt_.tmp
  724. fi
  725. # ============= dmake/msdos/ruletab.c ==============
  726. if test -f 'dmake/msdos/ruletab.c' -a X"$1" != X"-c"; then
  727.     echo 'x - skipping dmake/msdos/ruletab.c (File already exists)'
  728.     rm -f _shar_wnt_.tmp
  729. else
  730. > _shar_wnt_.tmp
  731. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/ruletab.c' &&
  732. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/ruletab.c,v 1.1 91/05/06 15:25:32 dvadura Exp $
  733. -- SYNOPSIS -- Default initial configuration of dmake.
  734. -- 
  735. -- DESCRIPTION
  736. --     Define here the initial set of rules that are defined before
  737. --    dmake performs any processing.
  738. --
  739. -- AUTHOR
  740. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  741. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  742. --
  743. -- COPYRIGHT
  744. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  745. -- 
  746. --      This program is free software; you can redistribute it and/or
  747. --      modify it under the terms of the GNU General Public License
  748. --      (version 1), as published by the Free Software Foundation, and
  749. --      found in the file 'LICENSE' included with this distribution.
  750. -- 
  751. --      This program is distributed in the hope that it will be useful,
  752. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  753. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  754. --      GNU General Public License for more details.
  755. -- 
  756. --      You should have received a copy of the GNU General Public License
  757. --      along with this program;  if not, write to the Free Software
  758. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  759. --
  760. -- LOG
  761. --     $Log:    ruletab.c,v $
  762. X * Revision 1.1  91/05/06  15:25:32  dvadura
  763. X * dmake Release Version 3.7
  764. X * 
  765. */
  766. X
  767. /* These are control macros for dmake that MUST be defined at some point
  768. X * if they are NOT dmake will not work!  These are default definitions.  They
  769. X * may be overridden inside the .STARTUP makefile, they are here
  770. X * strictly so that dmake can parse the STARTUP makefile */
  771. X
  772. static char *_rules[] = {
  773. X    "MAXLINELENGTH := 2046",
  774. X    "MAXPROCESSLIMIT := 1",
  775. X    "MAXPROCESS := 1",
  776. X    ".IMPORT .IGNORE: ROOTDIR",
  777. X    ".MAKEFILES : makefile.mk makefile",
  778. X    ".SOURCE    : .NULL",
  779. #include "startup.h"
  780. X    0 };
  781. X
  782. char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */
  783. X
  784. SHAR_EOF
  785. chmod 0640 dmake/msdos/ruletab.c ||
  786. echo 'restore of dmake/msdos/ruletab.c failed'
  787. Wc_c="`wc -c < 'dmake/msdos/ruletab.c'`"
  788. test 1951 -eq "$Wc_c" ||
  789.     echo 'dmake/msdos/ruletab.c: original size 1951, current size' "$Wc_c"
  790. rm -f _shar_wnt_.tmp
  791. fi
  792. # ============= dmake/msdos/runargv.c ==============
  793. if test -f 'dmake/msdos/runargv.c' -a X"$1" != X"-c"; then
  794.     echo 'x - skipping dmake/msdos/runargv.c (File already exists)'
  795.     rm -f _shar_wnt_.tmp
  796. else
  797. > _shar_wnt_.tmp
  798. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/runargv.c' &&
  799. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/runargv.c,v 1.1 91/05/06 15:25:32 dvadura Exp $
  800. -- SYNOPSIS -- run a sub process.
  801. -- 
  802. -- DESCRIPTION
  803. --    Use spawn to run a subprocess.
  804. --
  805. -- AUTHOR
  806. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  807. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  808. --
  809. -- COPYRIGHT
  810. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  811. -- 
  812. --      This program is free software; you can redistribute it and/or
  813. --      modify it under the terms of the GNU General Public License
  814. --      (version 1), as published by the Free Software Foundation, and
  815. --      found in the file 'LICENSE' included with this distribution.
  816. -- 
  817. --      This program is distributed in the hope that it will be useful,
  818. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  819. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  820. --      GNU General Public License for more details.
  821. -- 
  822. --      You should have received a copy of the GNU General Public License
  823. --      along with this program;  if not, write to the Free Software
  824. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  825. --
  826. -- LOG
  827. --     $Log:    runargv.c,v $
  828. X * Revision 1.1  91/05/06  15:25:32  dvadura
  829. X * dmake Release Version 3.7
  830. X * 
  831. */
  832. X
  833. #include <process.h>
  834. #include <errno.h>
  835. #include "extern.h"
  836. #include "sysintf.h"
  837. X
  838. static int  _abort_flg = FALSE;
  839. static void _add_child ANSI((CELLPTR, int));
  840. static void _finished_child ANSI((int));
  841. X
  842. PUBLIC int
  843. runargv(target, ignore, group, last, shell, cmd)
  844. CELLPTR target;
  845. int     ignore;
  846. int    group;
  847. int    last;
  848. int    shell;
  849. char    *cmd;
  850. {
  851. #if ! defined(_MSC_VER)
  852. X   extern char **environ;
  853. #endif
  854. X   int status;
  855. X   char **argv;
  856. X
  857. X   argv = Pack_argv( group, shell, cmd );
  858. X   _add_child(target, ignore);
  859. X   status = spawnvpe(P_WAIT, *argv, argv, environ);
  860. X   if( status == -1 ) Error("%s: %s", argv[0], strerror(errno));
  861. X   _finished_child(status);
  862. X   if( last && !Doing_bang ) Update_time_stamp( target );
  863. X
  864. X   return( 0 );
  865. }
  866. X
  867. X
  868. PUBLIC void
  869. Clean_up_processes()
  870. {
  871. X   _abort_flg = TRUE;
  872. X   _finished_child(-1);
  873. }
  874. X
  875. X
  876. PUBLIC int
  877. Wait_for_child( abort_flg, pid )
  878. int abort_flg;
  879. int pid;
  880. {
  881. X   return(1);
  882. }
  883. X
  884. X
  885. static int     _valid = -1;
  886. static CELLPTR _tg;
  887. static int     _ignore;
  888. X
  889. static void
  890. _add_child( target, ignore )
  891. CELLPTR target;
  892. int    ignore;
  893. {
  894. X   _tg = target;
  895. X   _ignore = ignore;
  896. X   _valid = 0;
  897. X
  898. X   Current_target = NIL(CELL);
  899. }
  900. X
  901. X
  902. static void
  903. _finished_child(status)
  904. int    status;
  905. {
  906. X   if( _valid == -1 ) return;
  907. X   Unlink_temp_files( _tg );
  908. X   _valid = -1;
  909. X   Handle_result( status, _ignore, _abort_flg, _tg );
  910. }
  911. SHAR_EOF
  912. chmod 0640 dmake/msdos/runargv.c ||
  913. echo 'restore of dmake/msdos/runargv.c failed'
  914. Wc_c="`wc -c < 'dmake/msdos/runargv.c'`"
  915. test 2611 -eq "$Wc_c" ||
  916.     echo 'dmake/msdos/runargv.c: original size 2611, current size' "$Wc_c"
  917. rm -f _shar_wnt_.tmp
  918. fi
  919. # ============= dmake/msdos/spawn.c ==============
  920. if test -f 'dmake/msdos/spawn.c' -a X"$1" != X"-c"; then
  921.     echo 'x - skipping dmake/msdos/spawn.c (File already exists)'
  922.     rm -f _shar_wnt_.tmp
  923. else
  924. > _shar_wnt_.tmp
  925. sed 's/^X//' << 'SHAR_EOF' > 'dmake/msdos/spawn.c' &&
  926. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/spawn.c,v 1.1 91/05/06 15:25:33 dvadura Exp $
  927. -- SYNOPSIS -- spawnvpe code to emulate spawnvpe call common to DOS compilers.
  928. -- 
  929. -- DESCRIPTION
  930. --    This implementation is further integrated into dmake in that it
  931. --    determines the program to execute and if it's extension is either
  932. --    .bat or .ksh it executes it using the appropriate shell based on the
  933. --    setting of .MKSARGS.  If .MKSARGS is set then in addition
  934. --    to the command tail getting built the arguments are also passed in the
  935. --    environment pursuant to the published MKS argument passing conventions.
  936. --    If the variable Swap_on_exec is set and the DOS OS supports it
  937. --    then the dmake executable image is swapped to secondary storage prior
  938. --    to running the child process.  This is requested by setting the
  939. --    appropriate flag in the call to exec.
  940. --
  941. --    This and the exec.asm routine are derived from work that was supplied
  942. --    to me by Kent Williams (williams@umaxc.weeg.uiowa.edu) and by
  943. --      Len Reed, (..!gatech!holos0!lbr or holos0!lbr@gatech.edu., Holos
  944. --    Software, Inc., Tucker, Ga.).  I sincerely acknowledge their help since
  945. --    their Turbo C, and MSC 6.0 code lead directly to this combined
  946. --    swapping exec that hopefully works with either compiler in all memory
  947. --    models.
  948. --
  949. -- AUTHOR
  950. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  951. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  952. --
  953. -- COPYRIGHT
  954. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  955. -- 
  956. --      This program is free software; you can redistribute it and/or
  957. --      modify it under the terms of the GNU General Public License
  958. --      (version 1), as published by the Free Software Foundation, and
  959. --      found in the file 'LICENSE' included with this distribution.
  960. -- 
  961. --      This program is distributed in the hope that it will be useful,
  962. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  963. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  964. --      GNU General Public License for more details.
  965. -- 
  966. --      You should have received a copy of the GNU General Public License
  967. --      along with this program;  if not, write to the Free Software
  968. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  969. --
  970. -- LOG
  971. --     $Log:    spawn.c,v $
  972. X * Revision 1.1  91/05/06  15:25:33  dvadura
  973. X * dmake Release Version 3.7
  974. X * 
  975. */
  976. X
  977. #include <stdio.h>
  978. #include <stdlib.h>
  979. X
  980. #if defined(_MSC_VER) && _MSC_VER >= 600
  981. X    /* Ignore the MSC 6.0 library's "const"-riddled prototype
  982. X       for spawnvpe.
  983. X    */
  984. # define spawnvpe _ignore_msc_spawnvpe
  985. # include <process.h>
  986. # undef spawnvpe
  987. X  int spawnvpe(int, char *, char **, char **);
  988. #else
  989. # include <process.h>
  990. #endif
  991. X
  992. #include <dos.h>
  993. #include <errno.h>
  994. #include <string.h>
  995. #include <alloc.h>
  996. #include <fcntl.h>
  997. #include "extern.h"
  998. #include "dirlib.h"
  999. #include "exec.h"
  1000. #include "sysintf.h"
  1001. X
  1002. extern int Interrupted;
  1003. X
  1004. /* variables and functions local to this file */
  1005. static char     *_findexec ANSI((char *, int *));
  1006. static char    **_getpath ANSI(());
  1007. static char far *_dos_alloc ANSI((uint16));
  1008. X
  1009. static uint16 _swap_mask;
  1010. static int    _mks_args;
  1011. static char   dot_com[] = ".COM",
  1012. X          dot_exe[] = ".EXE",
  1013. X              dot_bat[] = ".BAT",
  1014. X          dot_ksh[] = ".KSH";
  1015. X
  1016. /* Kinds of executables */
  1017. #define SCR 1
  1018. #define COM 2
  1019. #define EXE 4
  1020. #define ALL (SCR|COM|EXE)
  1021. X
  1022. /* How to make a long pointer */
  1023. #define CF(x) (char far *)x
  1024. X
  1025. /* Make sure we know how to get a segment out of a long pointer */
  1026. #ifndef FP_SEG
  1027. #define FP_SEG(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  1028. #endif
  1029. X
  1030. X
  1031. PUBLIC int
  1032. spawnvpe(mode, program, av, ep)/*
  1033. =================================
  1034. X   Spawn a process using an environment and a vector of arguments.
  1035. X   The code computes a new environment, puts the MKS arguments into
  1036. X   it if need be, and calls the appropriate routines to search the
  1037. X   path and to invoke the process. */
  1038. int  mode;
  1039. char *program;
  1040. char **av;
  1041. char **ep;
  1042. {
  1043. X   char **envp = ep;        /* Cause we are going to mess with it. */
  1044. X   char **argv = av;        /* Same with this one.               */
  1045. X   char cmdtail[129];
  1046. X   char far *environment;
  1047. X   char *tail;
  1048. X   char *swptmp;
  1049. X   unsigned int envsize;
  1050. X   unsigned int cmdsize;
  1051. X   int  cmdtailen;
  1052. X   int  i;
  1053. X   int  doswap;
  1054. X
  1055. X   /* First check to see if we can find the program to execute this way we
  1056. X    * don't alloc the environment and other such stuff prior to figuring out
  1057. X    * we don't know how to run the program. */
  1058. find_program:
  1059. X   if((program = _findexec(program, &i)) == NIL(char)) {
  1060. X      errno = ENOENT;
  1061. X      return( -1 );
  1062. X   }
  1063. X
  1064. X   /* i is set to TRUE in _findexec if the exec is a shell
  1065. X    * script (either .BAT or .KSH file), returns FALSE for all others. */
  1066. X   if( i && !Packed_shell ) {
  1067. X      /* Restore the spaces into the command line that were erased by
  1068. X       * the previous call to Pack_argv.  This enables us to repack the
  1069. X       * command as a shell command using Pack_argv again. */
  1070. X      for( i=0; argv[i] != NIL(char); i++ ) {
  1071. X         int x = strlen(argv[i]);
  1072. X         if( argv[i+1] != NIL(char) ) argv[i][x] = ' ';
  1073. X      }
  1074. X
  1075. X      argv = Pack_argv( FALSE, TRUE, *argv );
  1076. X
  1077. X      /* Go and find the program again, I hate goto's but it seems silly to
  1078. X       * use tail recursion here just for aesthetic purity. */
  1079. X      program = *argv;
  1080. X      goto find_program;
  1081. X   }
  1082. X
  1083. X   /* Compute size of *argv vector for passing as MKS style arguments */
  1084. X   cmdsize = strlen(*argv)+2;
  1085. X
  1086. X   /* So we have decided on a program to run, therefore pack the command tail
  1087. X    * and build the environment to pass to the exec code.  This loop packs the
  1088. X    * DOS command tail, and computes the size of all arguments for the MKS
  1089. X    * argument passing convention.  Note that we reserve one less byte in the
  1090. X    * command tail if we are not using MKS style argument passing.
  1091. X    *
  1092. X    * Make sure the command tail contains at leat a space.  Some commands fail
  1093. X    * to work if the command tail is only a \r, STUPID DOS! */
  1094. X   cmdtailen = (_mks_args = ((Glob_attr & A_MKSARGS) != 0))?3:2;
  1095. X   tail      = cmdtail+1;
  1096. X
  1097. X   if( argv[1] != NIL(char) )
  1098. X      for( i=1; argv[i] != NIL(char); i++ ) {
  1099. X     int arglen = strlen(argv[i]);
  1100. X
  1101. X     cmdsize += arglen+2;        /* Compute all args size for MKS */
  1102. X
  1103. X     if( (cmdtailen += arglen+1) <= 128 ) {
  1104. X        register char *p = argv[i];
  1105. X        tail[-1] = ' ';        /* put in the space */
  1106. X        while( *tail++ = *p++ );    /* put in the arg   */
  1107. X     }
  1108. X     else if( !_mks_args ) {
  1109. X        errno = E2BIG;        /* unless its MKS exit if arglist */
  1110. X        return(-1);            /* is too long.              */
  1111. X     }
  1112. X      }
  1113. X   else
  1114. X      *tail++ = ' ';
  1115. X
  1116. X   /* Finish the command tail set up, placing the length in the first byte,
  1117. X    * and the \r \n \0 at the end for DOS, MKS and us respectively. */
  1118. X   *cmdtail = tail-cmdtail-2;
  1119. X   tail[-1] = '\r';
  1120. X   if( _mks_args ) *tail++ = '\n';
  1121. X   *tail = '\0';
  1122. X
  1123. X   /* Compute size of environment, skipping any MKS arguments passed in our
  1124. X    * environment */
  1125. X   for(; *envp && **envp == '~'; envp++ );
  1126. X   for(i=0, envsize=_mks_args?cmdsize:1; envp[i] != NIL(char); i++ )
  1127. X      envsize += strlen(envp[i]) + 1;
  1128. X
  1129. X   /* Check the DOS version number here.  If it is < 3.0 then we don't
  1130. X    * even want to think about executing the swapping code.   Permanently
  1131. X    * set swap to 0. */
  1132. X   doswap = (_osmajor < 3) ? 0 : Swap_on_exec;
  1133. X
  1134. X   /* Set up temporary file for swapping */
  1135. X   swptmp = doswap?tempnam(NIL(char),"mk"):""; 
  1136. X
  1137. X   /* Allocate an appropriate sized environment block and align it on a
  1138. X    * paragraph boundary.  It will later get copied to an appropriately low
  1139. X    * place in the executable image so that when we swap out the environment
  1140. X    * is still present.  Use
  1141. X    *    _dos_alloc
  1142. X    * to allocate the environment segment.  The segment is freed by the call
  1143. X    * to exec. */
  1144. X   environment = _dos_alloc( envsize = ((envsize+16)>>4) );
  1145. X
  1146. X   /* First copy the arguments preceeded by ~ character if we are using
  1147. X    * MKS style argument passing */
  1148. X   if( _mks_args )
  1149. X      for(; *argv; argv++) {
  1150. X         register char *p = *argv;
  1151. X
  1152. X     *environment++ = '~';
  1153. X     while( *environment++ = *p++ );    /* Far dest, poss near ptr */
  1154. X      }
  1155. X
  1156. X   /* Now stick in the current evironment vectors. */
  1157. X   for(; *envp; envp++) {
  1158. X      register char *p = *envp;
  1159. X      while( *environment++ = *p++ );        /* Far dest, poss near ptr */
  1160. X   }
  1161. X   *environment = '\0';
  1162. X
  1163. X   /* Clear the interrupted flag, and exec  */
  1164. X   Interrupted = 0;
  1165. X   i = exec(doswap,CF(program),CF(cmdtail),FP_SEG(environment),CF(swptmp));
  1166. X
  1167. X   /* Now free the temporary file name */
  1168. X   if( doswap ) FREE(swptmp);
  1169. X
  1170. X   /* If swap was interrupted then quit properly from dmake. */
  1171. X   if( Interrupted ) Quit();
  1172. X
  1173. X   return(i);
  1174. }
  1175. X
  1176. X
  1177. PUBLIC void
  1178. Hook_std_writes( file )
  1179. char *file;
  1180. {
  1181. X   if( file!= NIL(char) ) {
  1182. X      int mode = O_BINARY | O_WRONLY | O_CREAT | O_TRUNC;
  1183. X      int handle;
  1184. X
  1185. X      if (*file == '+') {
  1186. X          ++file;             /* -F +file means append to file */
  1187. SHAR_EOF
  1188. true || echo 'restore of dmake/msdos/spawn.c failed'
  1189. fi
  1190. echo 'End of part 24, continue with part 25'
  1191. echo 25 > _shar_seq_.tmp
  1192. exit 0
  1193.  
  1194. exit 0 # Just in case...
  1195. -- 
  1196. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1197. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1198. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1199. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1200.